<template>
  <div class="chart-container">
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="date" label="日期" ></el-table-column>
      <el-table-column prop="name" label="姓名" ></el-table-column>
      <el-table-column prop="address" label="地址"></el-table-column>
      <el-table-column prop="mubiao" label="目标月奖金"></el-table-column>
      <el-table-column  label="绩效系数">
          <template slot-scope="scope">
            <el-select
              v-model="scope.row.jxixshu"
              clearable
              placeholder="请选择"
              @change="changeDataFm(scope.$index,scope.row.jxixshu)"
            >
              <el-option
                v-for="item in typeList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
       </template>

      </el-table-column>

      <el-table-column  label="绩效等级">
          <template slot-scope="scope">
              <span>{{scope.row.dengji}}</span>
          </template>

      </el-table-column>
       <el-table-column  label="实际月奖金">
          <template slot-scope="scope">
              <span>{{scope.row.xijiangjin}}</span>
          </template>
       </el-table-column>

    </el-table>

    

    <!-- <button @click="getTableDataFm">点击</button> -->

  </div>
</template>

<script>
export default {
  name: "demoTwo",
  filters: {},
  data() {
    return {
    
        typeList: [{
          value: '11',
          label: '11'
        }, {
          value: '22',
          label: '22'
        }, {
          value: '33',
          label: '33'
        }],
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
          mubiao:"540",
          jxixshu:"",
          dengji:"",
          xijiangjin:"",

        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
            mubiao:"520",
          jxixshu:"",
          dengji:"",
          xijiangjin:"",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
           mubiao:"500",
          jxixshu:"",
          dengji:"",
          xijiangjin:"",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
           mubiao:"400",
          jxixshu:"",
          dengji:"",
          xijiangjin:"",
        }
      ]
    };
  },
  created() {},
  mounted() {
    //this.getList();
  },
  methods: {
    changeDataFm(index,value){
      console.log(index)
       console.log(value)
       
      if(value==11){
               this.tableData[index].dengji='0级'
               this.tableData[index].xijiangjin=Number(this.tableData[index].jxixshu)*Number(this.tableData[index].mubiao) 
       }else if(value==22){
               this.tableData[index].dengji='1级'
               this.tableData[index].xijiangjin=Number(this.tableData[index].jxixshu)*Number(this.tableData[index].mubiao) 
       }else if(value==33){
                 this.tableData[index].dengji='2级'
                this.tableData[index].xijiangjin=Number(this.tableData[index].jxixshu)*Number(this.tableData[index].mubiao) 
       }
         

      // this.tableData.forEach
      
      


    }
    
  }
};
</script>

<style>
.chart-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 84px);
}
</style>
